# Run on R 3.3.0 GUI 1.68 Mavericks build (7202)
# June 3, 2016


##########################################
# FIGURE A.3
###########################################
library(foreign)
library(car)

### Set Path
# setwd("")

fulldata <- read.dta("industry_country.dta")

attach(fulldata)
summary(fulldata)

country <- fulldata$country
wtaxcomp <- fulldata$wtaxcomp
tariff <- fulldata$tariff
sector <- fulldata$sector
digit2 <- fulldata$digit2
region <- fulldata$region
avgcompetitors <- fulldata$avgcompetitors
lnavgexp <- fulldata$lnavgexport
lnavgage <- fulldata$lnavgage
lntotcap <- fulldata$lntotcap
obsolete <- fulldata$obsolete
idc <- fulldata$idc
gov_owner_share <-fulldata$gov_owner_share
free_media <- fulldata$free_media
ln_tot_pop <- fulldata$ln_tot_pop


res = lm(formula = wtaxcomp ~ factor(region) + lnavgage + avgcompetitors + lnavgexp + lntotlabor + free_media + gov_owner_share + lowfc*obsolete*tariff + factor(sector),  data = fulldata)

#pdf(".../outliers.pdf", width = 11, height = 8)
infIndexPlot(res, vars=c("Cook"), id.n = 2, id.col=2, main="", sub="")
#dev.off()




